package com.lwj.hiring.talent.dao;

import java.util.List;

import com.lwj.hiring.common.util.DBUtil;
import com.lwj.hiring.talent.entity.Talent;

/**
 * Talent Dao
 * 
 * @author Administrator
 *
 */
public class TalentDao {

	/**
	 * 求职者登录
	 * 
	 * @param code
	 * @param password
	 * @return
	 */
	public Talent login(String code, String password) {
		String sql = "SELECT id,name FROM talent WHERE code=? AND password=? LIMIT 1";
		return DBUtil.getUniqueResult(Talent.class, sql, code, password);
	}

	/**
	 * 求职者注册
	 * 
	 * @param list
	 * @return
	 */
	public int add(List<Object> list) {
		String sql = "INSERT INTO talent values(NUll,?,?,?,?,?,?,?,?)";
		return DBUtil.executeUpdate(sql, list);
	}

	/**
	 * 根据id 查询求职者信息
	 * 
	 * @param id
	 * @return
	 */
	public Talent queryById(int id) {
		String sql = "SELECT * FROM talent WHERE id=?";
		return DBUtil.getUniqueResult(Talent.class, sql, id);
	}

	/**
	 * 修改求职者信息
	 * 
	 * @param list
	 * @return
	 */
	public int update(List<Object> list) {
		String sql = "UPDATE talent SET name=?,phone=?,email=?,age=?,gender=?,hobby=? WHERE id=?";
		return DBUtil.executeUpdate(sql, list);
	}
}
